/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import bean.Aula;
import bean.Curso;
import bean.Horarios;
import controlador.ControladorCadastraHorario;
import java.io.IOException;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;


/**
 *
 * @author Júnior
 */
public class PainelHorarioTurma extends javax.swing.JPanel {

    List<Curso> listaCursos;
    List<String> listaTurmas;

    List<Horarios> listaHorarios;
    List<Aula> listaAulas;
    DefaultTableModel tabelaHorarioTurma = new DefaultTableModel(new String[]{"Início", "Fim","Segunda","Terça","Quarta","Quinta","Sexta"},0){@Override 
    public boolean isCellEditable(int row, int column){ 
 return false; 
 }};
    public PainelHorarioTurma() {
        initComponents();
        
        jTableHorario.getColumn("Início").setPreferredWidth(20);
        jTableHorario.getColumn("Fim").setPreferredWidth(20);
        listaCurso();
        preencheTabela("M");
        jButtonGerarPdf.setEnabled(false);
        if (jComboBoxCurso.getItemCount() > 0) {
            
            listaTurma();
            preencheTabela("M");
        }
        
              
    }

     private void listaCurso() {

        ControladorCadastraHorario ch = new ControladorCadastraHorario();
        listaCursos = ch.listaCurso();
        int t = listaCursos.size();
        for (int i = 0; i < t; i++) {
            Curso curso = listaCursos.get(i);
            jComboBoxCurso.addItem(curso.getNome());

        }

    }

    private void listaTurma() {
        int opcao = jComboBoxCurso.getSelectedIndex();
        if (listaCursos.isEmpty()) {
            JOptionPane.showMessageDialog(null, "Não há Cursos Cadastrados");
        } else {
            Curso curso = listaCursos.get(opcao);
            jComboBoxTurma.removeAllItems();
            ControladorCadastraHorario ch = new ControladorCadastraHorario();
            
            listaTurmas = ch.listaTurma(curso.getCodCurso());
            int t = listaTurmas.size();
            for (int i = 0; i < t; i++) {

                jComboBoxTurma.addItem(listaTurmas.get(i));

            }
        }
    }
     private void preencheTabela(String turno) {

        tabelaHorarioTurma.setNumRows(0);
        ControladorCadastraHorario ch = new ControladorCadastraHorario();
        listaHorarios = ch.lista(turno);
        int t = listaHorarios.size();
        for (int i = 0; i < t; i++) {
            Horarios horario = listaHorarios.get(i);
            tabelaHorarioTurma.addRow(new Object[]{horario.getInicio(), horario.getFim(),"","","","","",});

        }
        
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jPanelBotoes = new javax.swing.JPanel();
        jButtonBuscar = new javax.swing.JButton();
        jButtonGerarPdf = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jComboBoxCurso = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jComboBoxTurma = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        jComboBoxTurno = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTableHorario = new javax.swing.JTable();

        setMaximumSize(new java.awt.Dimension(830, 512));
        setMinimumSize(new java.awt.Dimension(830, 512));
        setPreferredSize(new java.awt.Dimension(830, 512));

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Relatório por Turma");

        jPanelBotoes.setLayout(new java.awt.GridBagLayout());

        jButtonBuscar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButtonBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/Find.png"))); // NOI18N
        jButtonBuscar.setText("Buscar");
        jButtonBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBuscarActionPerformed(evt);
            }
        });
        jPanelBotoes.add(jButtonBuscar, new java.awt.GridBagConstraints());

        jButtonGerarPdf.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButtonGerarPdf.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/List.png"))); // NOI18N
        jButtonGerarPdf.setText("Gerar PDF");
        jButtonGerarPdf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonGerarPdfActionPerformed(evt);
            }
        });
        jPanelBotoes.add(jButtonGerarPdf, new java.awt.GridBagConstraints());

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel2.setText("Curso :");

        jComboBoxCurso.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jComboBoxCurso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxCursoActionPerformed(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setText("Turma :");

        jComboBoxTurma.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jComboBoxTurma.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxTurmaActionPerformed(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel4.setText("Turno :");

        jComboBoxTurno.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jComboBoxTurno.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Manhã", "Tarde", "Noite" }));
        jComboBoxTurno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxTurnoActionPerformed(evt);
            }
        });

        jTableHorario.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jTableHorario.setModel(tabelaHorarioTurma);
        jTableHorario.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(jTableHorario);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 810, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboBoxTurno, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboBoxTurma, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboBoxCurso, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanelBotoes, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 830, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBoxCurso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jComboBoxTurno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jComboBoxTurma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(63, 63, 63)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(58, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addGap(0, 462, Short.MAX_VALUE)
                    .addComponent(jPanelBotoes, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jComboBoxTurnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTurnoActionPerformed
        jButtonGerarPdf.setEnabled(false);
        String turno;
        int opcao = jComboBoxTurno.getSelectedIndex();
        if (opcao == 0) {
            turno = "M";
        } else if (opcao == 1) {
            turno = "T";
        } else {
            turno = "N";
        }

        preencheTabela(turno);
        
        
    }//GEN-LAST:event_jComboBoxTurnoActionPerformed

    private void jButtonBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBuscarActionPerformed
        
        String turno;
        int opcao = jComboBoxCurso.getSelectedIndex();
        int opcao2 = jComboBoxTurma.getSelectedIndex();
        int opcao3 = jComboBoxTurno.getSelectedIndex();
        if (opcao3 == 0) {
            turno = "Manhã";
        } else if (opcao3 == 1) {
            turno = "Tarde";
        } else {
            turno = "Noite";
        }
        
        if (listaCursos.isEmpty()) {
            JOptionPane.showMessageDialog(null, "Não há Cursos Cadastrados");
        } else if (opcao2 < 0) {
            JOptionPane.showMessageDialog(null, "Não há Disciplina(s) cadastrada(s) para o Curso selecionado.");
        } else {
            
            Curso curso = listaCursos.get(opcao);
            ControladorCadastraHorario ch = new ControladorCadastraHorario();
            listaAulas = ch.listaAula(curso.getCodCurso(), turno.substring(0,1), listaTurmas.get(opcao2));
            if (listaAulas.isEmpty()) {
                JOptionPane.showMessageDialog(null, "Não há Horário cadastrado para o Curso: " + jComboBoxCurso.getSelectedItem() + " Turma: " + jComboBoxTurma.getSelectedItem());
            } else {
                montaTabela();
                jButtonGerarPdf.setEnabled(true);
            }
           
    
        }
    }//GEN-LAST:event_jButtonBuscarActionPerformed

    private void jComboBoxCursoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxCursoActionPerformed
        listaTurma();
        jButtonGerarPdf.setEnabled(false);
    }//GEN-LAST:event_jComboBoxCursoActionPerformed

    private void jButtonGerarPdfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGerarPdfActionPerformed
       /* if(listaAulas == null){
            JOptionPane.showMessageDialog(null, "Clique em BUSCAR, para preencher a tabela");
        }else if(listaAulas.isEmpty()){
            JOptionPane.showMessageDialog(null, "Clique em BUSCAR, para preencher a tabela");
        }else{
            System.out.println(listaAulas.size());*/
        Pdf pdf = new Pdf();
        String turno;
        int opcao = jComboBoxCurso.getSelectedIndex();
        int opcao2 = jComboBoxTurma.getSelectedIndex();
        int opcao3 = jComboBoxTurno.getSelectedIndex();
        if (opcao3 == 0) {
            turno = "Manhã";
        } else if (opcao3 == 1) {
            turno = "Tarde";
        } else {
            turno = "Noite";
        }
        if (opcao2 < 0) {
            JOptionPane.showMessageDialog(null, "Não há Disciplina(s) cadastrada(s) para o Curso selecionado.");
        } else {
            try {
                pdf.relatorioTurma(listaCursos.get(opcao).getNome(),listaTurmas.get(opcao2).toString(), turno, tabelaHorarioTurma);
                jButtonGerarPdf.setEnabled(false);
            } catch (IOException ex) {
                Logger.getLogger(PainelHorarioTurma.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        
    }//GEN-LAST:event_jButtonGerarPdfActionPerformed

    private void jComboBoxTurmaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTurmaActionPerformed
        String turno;
        int opcao = jComboBoxTurno.getSelectedIndex();
        if (opcao == 0) {
            turno = "M";
        } else if (opcao == 1) {
            turno = "T";
        } else {
            turno = "N";
        }
        jButtonGerarPdf.setEnabled(false);
        preencheTabela(turno);
    }//GEN-LAST:event_jComboBoxTurmaActionPerformed

     private void montaTabela() {
        int t = listaAulas.size();
        int y = 0;
        for (int i = 0; i < t; i++) {
            Horarios h = listaAulas.get(i).getHorario();
            int x = h.getCodHorario();
            for (int j = 0; j < listaHorarios.size(); j++) {
                if (listaHorarios.get(j).getCodHorario() != x) {
                } else {
                    y = j;
                    break;
                }
            }

            switch (listaAulas.get(i).getDia().getCodDia()) {
                case "Seg":
                    tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), y, 2);
                    break;
                case "Ter":
                    tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), y, 3);
                    break;
                case "Qua":
                    tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), y, 4);
                    break;
                case "Qui":
                    tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), y, 5);
                    break;
                default:
                    tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), y, 6);
                    break;
            }

        }
    }
     /*
    private void buscarManha() {
        int t = listaAulas.size();
        for (int i = 0; i < t; i++) {
            Horarios h = listaAulas.get(i).getHorario();
            int x = h.getCodHorario();

            switch (x) {
                case 1:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 6);
                            break;
                    }
                    break;
                case 2:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 6);
                            break;
                    }
                    break;
                case 3:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 6);
                            break;
                    }
                    break;
                case 4:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 6);
                            break;
                    }
                    break;
                case 5:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 6);
                            break;
                    }
                    break;

            }

        }
    }

    private void buscarTarde() {
        int t = listaAulas.size();
        for (int i = 0; i < t; i++) {
            Horarios h = listaAulas.get(i).getHorario();
            int x = h.getCodHorario();

            switch (x) {
                case 6:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 6);
                            break;
                    }
                    break;
                case 7:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 6);
                            break;
                    }
                    break;
                case 8:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 6);
                            break;
                    }
                    break;
                case 9:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 6);
                            break;
                    }
                    break;
                case 10:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 6);
                            break;
                    }
                    break;

            }

        }
    }

    private void buscarNoite() {
        int t = listaAulas.size();
        for (int i = 0; i < t; i++) {
            Horarios h = listaAulas.get(i).getHorario();
            int x = h.getCodHorario();

            switch (x) {
                case 11:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 0, 6);
                            break;
                    }
                    break;
                case 12:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 1, 6);
                            break;
                    }
                    break;
                case 13:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 2, 6);
                            break;
                    }
                    break;
                case 14:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 3, 6);
                            break;
                    }
                    break;
                case 15:
                    switch (listaAulas.get(i).getDia().getCodDia()) {
                        case "Seg":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 2);
                            break;
                        case "Ter":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 3);
                            break;
                        case "Qua":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 4);
                            break;
                        case "Qui":
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 5);
                            break;
                        default:
                            tabelaHorarioTurma.setValueAt(listaAulas.get(i).getDisciplina().getNome(), 4, 6);
                            break;
                    }
                    break;

            }

        }
    }
    
    */
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonBuscar;
    private javax.swing.JButton jButtonGerarPdf;
    private javax.swing.JComboBox jComboBoxCurso;
    private javax.swing.JComboBox jComboBoxTurma;
    private javax.swing.JComboBox jComboBoxTurno;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanelBotoes;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTableHorario;
    // End of variables declaration//GEN-END:variables
}
